import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AlarmRiskEventVO, AlarmRiskEventForm, AlarmRiskEventQuery } from './types';

/**
 * 查询关键报警风险事件列表
 */
export const listAlarmRiskEvent = (query?: AlarmRiskEventQuery): AxiosPromise<{ rows: AlarmRiskEventVO[]; total: number }> => {
  return request({
    url: '/system/alarmRiskEvent/list',
    method: 'get',
    params: query
  });
};

/** 获取关键报警风险事件详细 */
export const getAlarmRiskEvent = (id: string | number): AxiosPromise<{ data: AlarmRiskEventVO }> => {
  return request({
    url: `/system/alarmRiskEvent/${id}`,
    method: 'get'
  });
};

/** 新增关键报警风险事件 */
export const addAlarmRiskEvent = (data: AlarmRiskEventForm) => {
  return request({
    url: '/system/alarmRiskEvent',
    method: 'post',
    data
  });
};

/** 修改关键报警风险事件 */
export const updateAlarmRiskEvent = (data: AlarmRiskEventForm) => {
  return request({
    url: '/system/alarmRiskEvent',
    method: 'put',
    data
  });
};

/** 删除关键报警风险事件 */
export const delAlarmRiskEvent = (ids: string | number | Array<string | number>) => {
  return request({
    url: `/system/alarmRiskEvent/${ids}`,
    method: 'delete'
  });
};
